<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .active {
        text-decoration: underline;
    }
    .text-danger {
        font-weight: bold;
    }
</style>
<body>
    <script src="./js/vue.js"></script>
    <div id='app'>
        <!--第一种绑定了两个class属性对象实现绑定样式-->
       <div :class="{active:isActive,'text-danger':'hasError'}"><!--text-danger属性值加引号是因为存在一个（-）-->
        hello
       </div>
       <!--第二种通过绑定一个对象同样可以实现绑定样式-->
       <div :class="classObj">vue</div>
    </div>
    
    <script>
        let app =new Vue({
             el:"#app",
             data:{
               isActive:true,
               hasError:true,
               classObj: {
                active:true,
                'text-danger':true
               }
             }
        })
    </script>
</body>
</html>